package com.joyoung.datarespository;



import com.joyoung.cons.Cons;

import org.json.JSONObject;

/**
 * Created by Administrator on 2017\8\4 0004.
 */

public class HomePageBuilder {

    private JSONObject jsonObject = new JSONObject();


    public HomePageBuilder action(String action) throws Exception {
        jsonObject.put("op_action", action);
        jsonObject.put("sessionkey", Cons.sessionkey);
        return this;
    }


    public HomePageBuilder tagname(String tagname) throws Exception {
        jsonObject.put("tagname", tagname);
        return this;
    }

    public HomePageBuilder type(String type) throws Exception {
        jsonObject.put("type", type);
        return this;
    }

    public HomePageBuilder version(String version) throws Exception {
        jsonObject.put("version", version);
        return this;
    }

    public HomePageBuilder dcode(String dcode) throws Exception {
        jsonObject.put("dcode", dcode);
        return this;
    }

    public HomePageBuilder page(int start,int limit) throws Exception{
        JSONObject page = new JSONObject();
        page.put("start", start);
        page.put("limit", limit);
        jsonObject.put("page", page);
        return this;
    }


    public String build() throws Exception {
        return jsonObject.toString();
    }
}
